// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import vueRouter from 'vue-router'
import vueResource from 'vue-resource'

Vue.use(vueResource)
Vue.use(vueRouter)

Vue.config.productionTip = false

import index from './components/index.vue'
import register from './components/register.vue'
import discovery from './components/discovery.vue'
import center from './components/center.vue'
import teacherInfo from './components/teacherInfo.vue'
import search from './components/search.vue'
import feedback from './components/feedback.vue'
import modifyInfo from './components/modifyInfo.vue'
import modifyMobile from './components/modifyMobile.vue'
const routes = [
    { path: '/', redirect: '/index'}, 
    { path: '/index',  name:'index', component: index, meta: {keepAlive: true} },
    { path: '/register', name:"register", component: register, meta: {keepAlive: false}  },
    { path: '/discovery',  name:'discovery', component: discovery, meta: {keepAlive: false}  },
    { path: '/center',  name:'center', component: center, meta: {keepAlive: false}  },
    { path: '/teacherInfo/:id',  name:'teacherInfo', component: teacherInfo, meta: {keepAlive: false}  },
    { path: '/search',  name:'search', component: search, meta: {keepAlive: false}  },
    { path: '/feedback',  name:'feedback', component: feedback, meta: {keepAlive: false}  },
    { path: '/modifyInfo',  name:'modifyInfo', component: modifyInfo, meta: {keepAlive: false}  },
    { path: '/modifyMobile',  name:'modifyMobile', component: modifyMobile, meta: {keepAlive: false}  }
]

const router = new vueRouter({
  routes,
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})

new Vue({
  el: '#app',
  template: '<App/>',
  components: { App },
  router
});